package com.jf.cloud.product.bo.mongo;

import io.swagger.v3.oas.annotations.media.Schema;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

/**
 * 对应MongoDB中商品浏览记录表emp
 * @author 菠萝凤梨
 */
@Document("spu_browse_log")
@CompoundIndexes({
        @CompoundIndex(name = "id_idx", def = "{'spuBrowseLogId':1}", unique = true),
        @CompoundIndex(name = "userId_status_spuId_idx", def = "{'userId':1, 'status':1, 'spuId':1}"),
        @CompoundIndex(name = "userId_id_idx", def = "{'spuBrowseLogId':1, 'userId':1}"),
        @CompoundIndex(name = "userId_spuType_spuId_time_idx", def = "{'userId':1, 'spuType':1, 'spuId':1, 'createTime':1}"),
})
public class MongoSpuBrowseLogBO {

    @Id
    @Schema(description = "商品浏览记录id" )
    private Long spuBrowseLogId;

    @Schema(description = "用户id" )
    private Long userId;

    @Schema(description = "商品id" )
    private Long spuId;

    @Schema(description = "分类id" )
    private Long categoryId;

    @Schema(description = "1:正常 -1:删除" )
    private Integer status;

    @Schema(description = "商品类型" )
    private Integer spuType;

    @Schema(description = "创建时间" )
    private Date createTime;

    @Schema(description = "更新时间" )
    private Date updateTime;

    @Transient
    @Schema(description = "商品名称" )
    private String spuName;

    public Long getSpuBrowseLogId() {
        return spuBrowseLogId;
    }

    public void setSpuBrowseLogId(Long spuBrowseLogId) {
        this.spuBrowseLogId = spuBrowseLogId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getSpuId() {
        return spuId;
    }

    public void setSpuId(Long spuId) {
        this.spuId = spuId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Integer getSpuType() {
        return spuType;
    }

    public void setSpuType(Integer spuType) {
        this.spuType = spuType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getSpuName() {
        return spuName;
    }

    public void setSpuName(String spuName) {
        this.spuName = spuName;
    }

    @Override
    public String toString() {
        return "MongoSpuBrowseLogBO{" +
                "spuBrowseLogId=" + spuBrowseLogId +
                ", userId=" + userId +
                ", spuId=" + spuId +
                ", categoryId=" + categoryId +
                ", status=" + status +
                ", spuType=" + spuType +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", spuName='" + spuName + '\'' +
                '}';
    }
}
